//处理作者列表逻辑
const db=require("../lib/db")
function authorlist(){
    return new Promise((resolve,reject)=>{
        let sql="select *from author"
        db.querysql(sql).then(data=>{
           if(data.length==0){
   
           }else{
               let arr=data.sort(()=>0.5-Math.random())//返回乱序
               Buffer.from(String(data.id)).toString("base64")
               let arr2=[]
               arr.map(element =>{
                   arr2.push({
                       _id:Buffer.from(String(element.id)).toString("base64"),
                       userName:element.userName,
                       headImg:element.headImg,
                       desc:element.des
                   })
               })
               resolve(arr2)
           }
        })
    })

 
}
    

module.exports=authorlist


